package com.guigu.eduservice.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guigu.common.utils.R;
import com.guigu.eduservice.entity.EquipmentVideo;
import com.guigu.eduservice.service.EquipmentVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 设备视频表（存储设备的展示视频，可选上传） 前端控制器
 * </p>
 *
 * @author Xiaosong
 * @since 2025-10-23
 */
@RestController
@RequestMapping("/advertisement/equipmentVideo")
public class EquipmentVideoController {
        @Autowired
    private EquipmentVideoService equipmentVideoService;
        //根据equipment_id查询设备视频
    @GetMapping("/{equipmentId}")
    public R SelectEquipmentVideo(@PathVariable Long equipmentId){
        System.out.println("进入设备视频页面"+ equipmentId);
        QueryWrapper<EquipmentVideo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("equipment_id",equipmentId);
        List<EquipmentVideo> equipmentVideo = equipmentVideoService.list(queryWrapper);
        System.out.println("设备视频列表"+equipmentVideo);
        return R.ok().data("equipmentVideo",equipmentVideo);
    }
}
